package RMIClient;

import java.rmi.RMISecurityManager;

import eventReservationServer.IReservationEventServer;


public class RMIServiceLocator
{
	private IReservationEventServer service;
	
	private String RMIName = "//" + util.Settings.BESOCIAL_SERVER_IP + ":" + util.Settings.BESOCIAL_SERVER_PORT + "/" + "RMIServer";

	public IReservationEventServer getService()
	{
		if (System.getSecurityManager() == null)
		{
			System.setSecurityManager(new RMISecurityManager());
		}
		
		try
		{
			service = (IReservationEventServer) java.rmi.Naming.lookup(RMIName);
		} 
		catch (Exception e)
		{
			System.err.println("RMIServiceLocator exception: " + e.getMessage());
			e.printStackTrace();
		}
		
		return service;
	}
}
